/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package parser;

public class Pair<A,B> {
    private A first;
    private B second;
    
    public Pair(A first, B second) {
        this.first = first;
        this.second = second;
    }
    
    public A getFirst() {
        return first;
    }
    
    public B getSecond() {
        return second;
    }
    
    @Override
    public String toString() {
        return first.toString() + "," + second.toString();
    }
    
    public boolean equals(Object o) {
        if (o == null)
            return false;
        if (!(o instanceof Pair))
            return false;
        
        Pair<A,B> p = (Pair<A,B>) o;
        return first.equals(p.getFirst()) && second.equals(p.getSecond());
    }
    
    @Override
    public int hashCode() {
        return first.hashCode() + second.hashCode();
    }
}
